#ifndef INTERFACE_BUTTON_HPP
#define INTERFACE_BUTTON_HPP

#include "Widget.hpp"
#include "GlobalDefines.hpp"
#include "Event.hpp"

namespace mi 
{
    class Button : public Widget
    {
    public:
        Button(std::string text);

        // button specific functions

        void SetCallbackFunction(Callable* object);

        bool IsPressed ();

        // input overrides

        Widget* MouseClick(sf::Mouse::Button button, sf::MouseState state, int x, int y);
    
        Widget* MouseMoved(int x, int y, int dx, int dy);
        
        Widget* MouseDragged(int x, int y, int dx, int dy);

        // Overwrite the pure virtuals from Widget

        void Draw2D ();

        bool Update (double dTime);

    private:
        bool hoverOver;

        bool pressed;

        Callable *callableObject;

        CallableFunction callback;
    
        void DrawHoverFace(Vec2i start, Vec2i end);

        void DrawActiveFace(Vec2i start, Vec2i end);

        void DrawButtonFace(Vec2i start, Vec2i end);

        sf::Text txt;
    };
}

#endif